package com.h3c.nem.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.h3c.nem.enums.CareInfoType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import javax.persistence.Column;
import javax.persistence.Table;
import java.util.Date;

/**
 * 员工关怀信息
 *
 * @author z22968
 * @date 2022/6/8 16:37
 */
@Data
@Table(name = "tb_care_info")
public class TbCareInfo {

    @TableId(type = IdType.ASSIGN_ID)
    private String id;

    // 新员工工号
    @Column(name = "new_worker_id")
    private String newWorkerId;

    // 老员工工号
    @Column(name = "old_worker_id")
    private String oldWorkerId;

    // 类型
    @Column(name = "type")
    private CareInfoType type;

    // 新员工表中创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="Asia/Shanghai")
    @Column(name = "origin_create_time")
    Date originCreateTime;

    // 发送通知时间
    @Column(name = "notice_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone="Asia/Shanghai")
    private Date noticeTime;

    // 实际发送通知时间
    @Column(name = "actual_notice_time")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone="Asia/Shanghai")
    private Date actualNoticeTime;

    // 创建人
    @Column(name = "created_by")
    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    // 创建时间
    @Column(name = "created_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="Asia/Shanghai")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    // 更新人
    @Column(name = "update_by")
    @TableField(fill = FieldFill.UPDATE)
    private String updateBy;

    // 更新时间
    @Column(name = "update_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone="Asia/Shanghai")
    @TableField(fill = FieldFill.UPDATE)
    private Date updateTime;

    @Getter
    @AllArgsConstructor
    public enum RelateType {
        EXCELLENT_PERFORMANCE(0, "绩效优秀"),
        SAME_DEPT(1, "同部门"),
        SCHOOL_FELLOW(2, "校友"),
        SAME_BIRTH_PLACE(3, "同乡"),
        SAME_WORK_PLACE(4, "同工作地");

        @EnumValue
        private final Integer code;

        //    @JsonValue
        private final String name;
    }
}
